var xmlHttp;

function sendRequest(method, url, content, callback) {
    
    if(window.XMLHttpRequest) {
        //Mozilla
        xmlHttp = new XMLHttpRequest();
        if(xmlHttp.overrideMimeType) {
            //MIME
            xmlHttp.overrideMimeType("text/xml");
        }
        
    } else if(window.ActiveXObject) {
        //IE
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e){}
        }
    }
    
    if( !xmlHttp ){
    	window.alert("不支持此浏览器！");
    	return false;
    }

    if(method.toLowerCase() == "get") {
        xmlHttp.open(method, url, true);
    } else if(method.toLowerCase() == "post") {
        xmlHttp.open(method, url, true);
        xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    } else {
        window.alert("");
        return false;
    }

	xmlHttp.onreadystatechange = callback;
	
	if (content == null){
		xmlHttp.send(null);
	}else{
    	xmlHttp.send(content);
    }
}